<?php
function __autoload($class_name) 
    {
        include $class_name . '.php';
    }
    if(isset($_GET['id']))
    {
        $id = $_GET['id'];        
    }
    else
    {
        header('Location: index.php');       
        exit();
    }
    $conn = new dbConnection();
    $query = 'SELECT * FROM articles WHERE id = '.$id;
    $sql_result = $conn->db_query($query);
    $row = mysql_fetch_array($sql_result, MYSQL_ASSOC);
    $article = new article(
        $row['id'], 
        $row['id_author'], 
        $row['id_section'], 
        $row['date'], 
        $row['counter'], 
        $row['header'],
        $row['anotation'], 
        $row['article'],
        $row['pending']);
    $content = $article->render();
    $page = new page('clanky');
    echo $page->render($content);
?>
